package cn.edu.bjut.homework.chapter4;

public class Cpc extends Classification {
    protected char position;
    protected char value;

    public char getPosition() {
        return position;
    }

    public void setPosition(char position) {
        this.position = position;
    }

    public char getValue() {
        return value;
    }

    public void setValue(char value) {
        this.value = value;
    }

    public Cpc(char section, int class_num, char subclass, int main_group, int sub_group, char position, char value) {
        super(section, class_num, subclass, main_group, sub_group);
        this.position = position;
        this.value = value;
    }

    public Cpc(String s, char position, char value) {
        super(s);
        this.position = position;
        this.value = value;
    }

    public Cpc(String s) {
        super(s);
        this.position = s.charAt(s.length() - 2);
        this.value = s.charAt(s.length() - 1);
    }

    @Override
    public String toString() {
        return String.format("%s%02d%s%4d/%-5d %s %s", section, class_num, subclass, main_group, sub_group, position, value);
    }
}